<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

/**
 * 顶部工具栏配置
 */
class ColumnsToggler extends AmisBasics
{
    public function className($className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 按钮的 CSS 类名
     * @param $btnClassName
     * @return $this
     */
    public function btnClassName($btnClassName)
    {
        $this->btnClassName = $btnClassName;
        return $this;
    }

    /**
     * 按钮文字
     * @param $label
     * @return $this
     */
    public function label(string $label)
    {
        $this->label = $label;
        return $this;
    }

    /**
     * 按钮提示文字
     * @param string $tooltip
     * @return $this
     */
    public function tooltip(string $tooltip)
    {
        $this->tooltip = $tooltip;
        return $this;
    }

    /**
     * 按钮禁用状态下的提示
     * @param string $disabledTip
     * @return $this
     */
    public function disabledTip(string $disabledTip)
    {
        $this->disabledTip = $disabledTip;
        return $this;
    }

    /**
     * 点击内容是否关闭
     * @param bool $IsLeft
     * @return $this
     */
    public function align(bool $IsLeft = true)
    {
        $this->align = $IsLeft ? 'left' : 'right';
        return $this;
    }

    /**
     * 按钮大小，参考按钮
     * @param string $size
     * @return $this
     */
    public function size(string $size = '')
    {
        if (in_array($size, ['xs', 'sm', 'md', 'lg'])) {
            $this->size = $size;
        }
        return $this;
    }

    /**
     * 弹窗底部按钮大小，参考按钮
     * @param string $size
     * @return $this
     */
    public function footerBtnSize(string $size = '')
    {
        if (in_array($size, ['xs', 'sm', 'md', 'lg'])) {
            $this->footerBtnSize = $size;
        }
        return $this;
    }

    /**
     * 按钮样式，参考按钮
     * @param string $level
     * @return $this
     */
    public function level(string $level = 'default')
    {
        $this->level = $$level;
        return $this;
    }

    /**
     * 是否可通过拖拽排序
     * @param bool $draggable
     * @return $this
     */
    public function draggable(bool $draggable = false)
    {
        $this->draggable = $draggable;
        return $this;
    }

    /**
     * 默认是否展开
     * @param bool $defaultIsOpened
     * @return $this
     */
    public function defaultIsOpened(bool $defaultIsOpened = false)
    {
        $this->defaultIsOpened = $defaultIsOpened;
        return $this;
    }

    /**
     * 是否隐藏展开的图标
     * @param bool $hideExpandIcon
     * @return $this
     */
    public function hideExpandIcon(bool $hideExpandIcon = true)
    {
        $this->hideExpandIcon = $hideExpandIcon;
        return $this;
    }

    /**
     * 是否显示遮罩层
     * @param bool $overlay
     * @return $this
     */
    public function overlay(bool $overlay = false)
    {
        $this->overlay = $overlay;
        return $this;
    }

    /**
     * 点击外部是否关闭
     * @param bool $closeOnOutside
     * @return $this
     */
    public function closeOnOutside(bool $closeOnOutside)
    {
        $this->closeOnOutside = $closeOnOutside;
        return $this;
    }

    /**
     * 点击内容是否关闭
     * @param bool $closeOnClick
     * @return $this
     */
    public function closeOnClick(bool $closeOnClick)
    {
        $this->closeOnClick = $closeOnClick;
        return $this;
    }

    /**
     * 是否只显示图标。
     * @param bool $iconOnly
     * @return $this
     */
    public function iconOnly(bool $iconOnly = false)
    {
        $this->iconOnly = $iconOnly;
        return $this;
    }

    /**
     * 按钮的图标
     * @param string $icon
     * @return $this
     */
    public function icon(string $icon)
    {
        $this->icon = $icon;
        return $this;
    }
}